package com.codeforces.contest.c320;

import java.util.Scanner;


public class A {

	static Scanner scanner = new Scanner(System.in);
	static String str;

	public static void main(String[] args) {
		str = scanner.next();
		boolean magic = dfs(str, 0);
		if (magic) {
			System.out.println("YES");
		}
		else {
			System.out.println("NO");
		}
	}

	private static boolean dfs(String s, int from) {
		if (from == s.length()) {
			return true;
		}
		if (s.startsWith("144",from)) {
			return dfs(s,from+3);
		}
		else if (s.startsWith("14",from)) {
			return dfs(s,from+2);
		}
		else if (s.startsWith("1",from)) {
			return dfs(s,from+1);
		}
		else return false;
	}

}
